#include "resize_bilinear_v2_d.h"
namespace ge {



    // ---------------ResizeBilinearV2D Op Start-------------------
    IMPLEMT_COMMON_INFERFUNC(ResizeBilinearV2DInferShape) {

        vector<int64_t> images_shape = op.GetInputDesc("x").GetShape().GetDims();
        vector<int64_t> size_out;
        if (op.GetAttr("size", size_out) == ge::GRAPH_FAILED) {
            return GRAPH_FAILED;
        }

        if (size_out.size() != 2) {
            return GRAPH_FAILED;
        }
        Format input_format = op.GetInputDesc("x").GetFormat();
        TensorDesc td = op.GetOutputDesc("y");
        vector<int64_t> y_shape;
        if (input_format == FORMAT_NHWC) {
            y_shape.push_back(images_shape[0]);
            y_shape.push_back(size_out[0]);
            y_shape.push_back(size_out[1]);
            y_shape.push_back(images_shape[3]);
        } else if (input_format == FORMAT_NCHW) {
            y_shape.push_back(images_shape[0]);
            y_shape.push_back(images_shape[1]);
            y_shape.push_back(size_out[0]);
            y_shape.push_back(size_out[1]);
        } else {
            return GRAPH_FAILED;
        }
        td.SetShape(ge::Shape(y_shape));
        td.SetDataType(DT_FLOAT);
        (void)op.UpdateOutputDesc("y", td);
        return GRAPH_SUCCESS;
    }


    IMPLEMT_VERIFIER(ResizeBilinearV2D, ResizeBilinearV2DVerify)
    {
        return GRAPH_SUCCESS;
    }

    COMMON_INFER_FUNC_REG(ResizeBilinearV2D, ResizeBilinearV2DInferShape);
    VERIFY_FUNC_REG(ResizeBilinearV2D, ResizeBilinearV2DVerify);

}  // namespace ge
